Imports System.Data.SqlClient
Partial Public Class TGB
    Inherits System.Web.UI.MasterPage
    Public menu As CapaDeNegocios.nMenu = New CapaDeNegocios.nMenu
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            mnuPrincipal.Visible = False
            LblLogo.Visible = False
            LblUsuarioLog.Visible = False
            mnuPrincipal.Visible = False
            ImgBanner.Visible = False
            ImgInicio.Visible = False
            If Session("Login") <> "Anonimo" Then
                BtnCerrar.Text = "Cerrar Sesion"
                LblUsuarioLog.Text = CStr(Session("Login"))
                mnuPrincipal.Items.Clear()
                LlenarMenu()
                LblLogo.Visible = True
                LblUsuarioLog.Visible = True
                mnuPrincipal.Visible = True
                ImgBanner.Visible = True
                ImgInicio.Visible = True

            Else
                BtnCerrar.PostBackUrl = "javascript:var kk=window.open('FrmLogin.aspx','Login' ,'Width=460,Height=408,Scrollbars=NO,Resizable=NO,Location=NO,Menubar=NO,Status=NO,Titlebar=NO,Toolbar=NO,Directories=NO');"
            End If
        End If
    End Sub
    Sub LlenarMenu()
        mnuPrincipal = menu.ObtenerMenuGrupo(mnuPrincipal, LblUsuarioLog.Text)
        'Alertas()
        'mnuPrincipal = menu.ObtenerMenu(mnuPrincipal)
        'ObtenerMenu(mnuPrincipal)
    End Sub
    'Protected Sub BtnCerrar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCerrar.Click
    '    If Session("Login") <> "Anonimo" Then
    '        mnuPrincipal.Visible = False
    '        LblLogo.Visible = False
    '        LblUsuarioLog.Visible = False
    '        mnuPrincipal.Visible = False
    '        mnuPrincipal.Items.Clear()
    '        Session("Login") = "Anonimo"
    '        BtnCerrar.Text = "Iniciar Sesion"
    '        Response.Redirect("/")
    '    End If
    'End Sub
    Public Sub BtnCerrar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCerrar.Click
        If Session("Login") <> "Anonimo" Then
            mnuPrincipal.Visible = False
            LblLogo.Visible = False
            LblUsuarioLog.Visible = False
            mnuPrincipal.Visible = False
            mnuPrincipal.Items.Clear()
            Session("Login") = "Anonimo"
            BtnCerrar.Text = "Iniciar Sesion"
            Response.Redirect("/")
            ImgBanner.Visible = False
            ImgInicio.Visible = False
        End If
    End Sub

End Class
